﻿using DAL;
using Model;

namespace BLL
{
    public class RoomTypeBLL
    {
        public RoomTypeBLL (RoomTypeDAL roomTypeDAL)
        {
            RoomTypeDAL = roomTypeDAL;
        }
        public RoomTypeDAL RoomTypeDAL { get; }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="roomType"></param>
        /// <returns></returns>
        public int Add(RoomType roomType)
        {
            try
            {
                
                return RoomTypeDAL.Add(roomType);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Delete(int id)
        {
            try
            {
                
                return RoomTypeDAL.Delete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="roomType"></param>
        /// <returns></returns>
        public int Update(RoomType roomType)
        {
            try
            {
                
                return RoomTypeDAL.Update(roomType);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public List<RoomType> GetShow()
        {
            try
            {
                return RoomTypeDAL.GetShow();
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 反添
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public RoomType GetType(int id)
        {
            try
            {
                return RoomTypeDAL.GetType(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="name"></param>
        /// <param name="Count"></param>
        /// <param name="Sum"></param>
        /// <param name="Index"></param>
        /// <param name="Size"></param>
        /// <returns></returns>
        public List<RoomType> Show(string? name, out int Count, out int Sum, int Index = 1, int Size = 2)
        {
            try
            {
                
                return RoomTypeDAL.Show(name,out Count,out Sum, Index, Size);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
